﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GMusicUtil.Common.ViewModels;

namespace GMusicUtil
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            DataContext = new LoaderViewModel();
        }

        private void Mp3DirectoryBrowseClick(object sender, RoutedEventArgs e)
        {
            using (var fbd = new FolderBrowserDialog())
            {
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    mp3DirectoryInput.Text = fbd.SelectedPath;
                }
            }
        }

        private void DatabaseBrowseClick(object sender, RoutedEventArgs e)
        {
            using (var ofd = new OpenFileDialog())
            {
                ofd.Filter = "Google Music Database Files (*.db)|*.db";

                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    databasePathInput.Text = ofd.FileName;
                }
            }
        }

        private void LogTextChanged(object sender, TextChangedEventArgs e)
        {
            logDisplay.ScrollToEnd();
        }
    }
}
